package cn.lysj.framework.customer.controller;

import cn.lysj.framework.base.BaseController;
import cn.lysj.framework.common.annotation.CurrentUser;
import cn.lysj.framework.common.domain.User;
import cn.lysj.framework.common.utils.pagination.PageUtil;
import cn.lysj.framework.common.utils.pagination.PageVo;
import cn.lysj.framework.common.utils.web.Resp;
import cn.lysj.framework.customer.domain.CustomerVip;
import cn.lysj.framework.customer.service.CustomerVipService;
import cn.lysj.framework.foodv2.vo.FoodListVo;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
 * @author zwj
 * @description VIP用户控制层
 * @create 2019-01-15 15:43:50
 **/
@Slf4j
@RestController
@Api(description = "VIP用户管理接口")
@RequestMapping("/customer_vip")
public class CustomerVipController extends BaseController<CustomerVip>{

    @Resource
    private CustomerVipService customerVipService;

    @Override
    public CustomerVipService getService() {
        return customerVipService;
    }

    @PostMapping("/get_customer_vip_info")
    public Resp getCustomerVipInfo(@CurrentUser User user, PageVo pageVo){
        Pageable pageable = PageUtil.initPage(pageVo);
        return new Resp(customerVipService.getRepository().queryStoreCustomerVipInfo(pageable,user.getStoreId()));
    }

}
